#:import environ os.environ
#:import version kivymd.__version__


<KitchenSinkContentNavigationDrawer>

    BoxLayout:
        orientation: "vertical"

        FloatLayout:
            size_hint_y: None
            height: "200dp"

            canvas:
                Color:
                    rgba: app.theme_cls.primary_color
                Rectangle:
                    pos: self.pos
                    size: self.size

            BoxLayout:
                id: top_box
                size_hint_y: None
                height: "200dp"
                x: root.parent.x
                pos_hint: {"top": 1}

                FitImage:
                    source: f"{environ['KITCHEN_SINK_ASSETS']}kivymd.png"

            MDIconButton:
                icon: "close"
                x: root.parent.x + dp(10)
                pos_hint: {"top": 1}
                on_release: root.parent.set_state()

            MDLabel:
                markup: True
                text: f"[b]KivyMD[/b]\nVersion: {version}"
                x: root.parent.x + dp(10)
                y: root.height - top_box.height + dp(10)
                size_hint_y: None
                height: self.texture_size[1]

        ScrollView:
            pos_hint: {"top": 1}

            MDGridLayout:
                id: box_item
                cols: 1
                adaptive_height: True


<KitchenSinkNavigationDrawer>:
    name: "navigation drawer"

    MDNavigationLayout:

        ScreenManager:

            Screen:

                BoxLayout:
                    orientation: "vertical"

                    MDToolbar:
                        title: "Navigation Drawer"
                        md_bg_color: app.theme_cls.primary_color
                        elevation: 10
                        left_action_items: [["menu", lambda x: nav_drawer.set_state("toggle")]]
                        right_action_items: [["arrow-left", lambda x: app.back_to_home_screen()]]

                    BoxLayout:
                        orientation: "vertical"
                        padding: "16dp"
                        spacing: "8dp"

                        MDRaisedButton:
                            text: "MDNavigationDrawer.type = " + nav_drawer.type
                            on_release: nav_drawer.type = "standard" if nav_drawer.type == "modal" else "modal"

                        MDRaisedButton:
                            text: "MDNavigationDrawer.anchor = " + nav_drawer.anchor
                            on_release: nav_drawer.anchor = "right" if nav_drawer.anchor == "left" else "left"

                        Widget:

        MDNavigationDrawer:
            id: nav_drawer

            KitchenSinkContentNavigationDrawer:
                id: content_drawer
